package com.hst.capacity.domain.model.request.driver;

import com.hst.capacity.domain.common.constants.Constants;
import com.hst.capacity.domain.model.request.PageParam;
import com.hst.capacity.infra.util.StringUtil;
import lombok.Data;
import org.apache.ibatis.type.Alias;

import javax.validation.constraints.NotEmpty;
import java.util.List;

@Data
@Alias("driverSearchParam")
public class DriverSearchParam extends PageParam {

    private String cityCode;

    private String status;
    //0 自营司机 1 加盟司机
    private String driveType;

    private String codeDriver;//?

    private String phoneDriver;

    private String idAgent;

    @NotEmpty(message = "运营商ID[idFranchisee]不能为空")
    private String idFranchisee;

    private String realName;

    private String keyWord;

    private String idCityLine;
    private String idLine;
    // 0:不限定线路1：线路限定
    private int lineFlg;

    private String idOrder;

    private String flgCar;

    private String arrStatus;

    private String carTypes;

    private List<String> carTypeList;

    public void setCarTypeList() {
        this.carTypeList = StringUtil.StringToList(this.carTypes);
    }

    public void setStatusArr(String status) {
        switch (status) {
            case "0":
                this.arrStatus = String.valueOf(Constants.DriverStatus.OFFLINE);
                break;
            case "1": {
                this.arrStatus = String.format("%d,%d", Constants.DriverStatus.ONLINE, Constants.DriverStatus.TAKE_ORDER);
                break;
            }
            case "100":
            case "101": {
                this.arrStatus =  String.format("%d,%d", Constants.DriverStatus.AUDIT, Constants.DriverStatus.IN_REVIEW);
                break;
            }
            default:
                this.arrStatus = null;
                break;
        }
    }

}
